UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AARVPbl9CXLeu5cmdSUaKQpYJECv43vtjIKxJS2RP+Q=' 
WHERE 
  key_id = 'e2b028dd85d620fcd122432e6ffd476e090ca48dce6c6c240114586bc8de8688' 
  AND (
    token = 'AARVPbl9CXLeu5cmdSUaKQpYJECv43vtjIKxJS2RP+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030