UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b3Djf2nA0emJ0PKdbV0VivthAxqIIdQ6Q/7tcn0eEi8=' 
WHERE 
  key_id = '8290f4a22e5a4f737e27a6c54f8acde88a7c4f1dac1cd601bf1567c4e4a0ecf4' 
  AND (
    token = 'b3Djf2nA0emJ0PKdbV0VivthAxqIIdQ6Q/7tcn0eEi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052