UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0YJyYBlFCv8TuTX+4Yb7IWehN6KSU+cJUpyUZUrZ6c0=' 
WHERE 
  key_id = 'b56f295985f72973cef637dd5599d6684a13021cb80077854b3a990c5d837fe5' 
  AND (
    token = '0YJyYBlFCv8TuTX+4Yb7IWehN6KSU+cJUpyUZUrZ6c0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087