UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfUagoT76ob2rrcPoerV/uVWU97ERIeRHQ2+n06YR0o=' 
WHERE 
  key_id = '5aebfd033009aca9327f275f960d1fb1b620d9597b63f70e1c0dd3079891a00d' 
  AND (
    token = 'CfUagoT76ob2rrcPoerV/uVWU97ERIeRHQ2+n06YR0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023