UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3g7I1jRel5i8+EsHOWtLNes7Nm7gOmUq/Cju5CVBfUk=' 
WHERE 
  key_id = '065d35f10919a391b9f1e9876dfa435f705b46947d50983a85eec4a4da809894' 
  AND (
    token = '3g7I1jRel5i8+EsHOWtLNes7Nm7gOmUq/Cju5CVBfUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021