UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sE5RSZje2xUpDj/rArYZg76fs2g1LetwzBuRHYjMQLg=' 
WHERE 
  key_id = '45ad20029e74613a44c203e974c0c2b12e038e3d89e69b12f17803e89a870056' 
  AND (
    token = 'sE5RSZje2xUpDj/rArYZg76fs2g1LetwzBuRHYjMQLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031