UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HezsbBJ0c3r/qIre1PGpJys4strgsqg+HslwlvBtijk=' 
WHERE 
  key_id = '3c03750f0e14b19b04bbdc25d0d70897099a3b146548ac49ef626b6189c860c6' 
  AND (
    token = 'HezsbBJ0c3r/qIre1PGpJys4strgsqg+HslwlvBtijk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033