UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SQTPmTjhtHfwFQ+/kNFuJIhHiosG36rnoEIa9X6KzWs=' 
WHERE 
  key_id = '51b5816e32c134dbb2bf3e2aad103b7d9a1934752f5b4d0189d5bcfe714997c0' 
  AND (
    token = 'SQTPmTjhtHfwFQ+/kNFuJIhHiosG36rnoEIa9X6KzWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042