UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z2IXyk1oXx2QQu+Z4Nhhl5pzqDUH48RE17OP2iOdVw0=' 
WHERE 
  key_id = 'c65a933df0370014c822e59a549f1dbaa6884a396bb589656a09de5e72da6d65' 
  AND (
    token = 'z2IXyk1oXx2QQu+Z4Nhhl5pzqDUH48RE17OP2iOdVw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041