UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cLxHSKptWPfsfX7FTV/OqoWNdJyGC9/EwL3VVQsfPIk=' 
WHERE 
  key_id = 'be95a38d8a4388aa50f7504638d0975be6f084bb1860681532a832d94d139b9c' 
  AND (
    token = 'cLxHSKptWPfsfX7FTV/OqoWNdJyGC9/EwL3VVQsfPIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023