UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sOheM6jXUfhhiZqoaeAM60FcWEo7j3/1McTLughat94=' 
WHERE 
  key_id = '5d94a333ba45fcdb34efa71df2bcff62f1a7e54fe3d97f587cf1b24b8948d510' 
  AND (
    token = 'sOheM6jXUfhhiZqoaeAM60FcWEo7j3/1McTLughat94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042