UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oCtAcQkci7yP5J7Riu1sT2eoh/sfwlxC4QBJgnYZ2kQ=' 
WHERE 
  key_id = '5b724aa92078a5f1503addbb50f9ba9f30eba9efe924438a0fae22de5cb7868f' 
  AND (
    token = 'oCtAcQkci7yP5J7Riu1sT2eoh/sfwlxC4QBJgnYZ2kQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023