UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r5N3REnWLQbCP+E3a0TuH3jSh7Vev0twjmosqNQZmOY=' 
WHERE 
  key_id = '25024d692d598c4b8bab029c1aa0b0ae742324a37b671652baf210c3f1b517eb' 
  AND (
    token = 'r5N3REnWLQbCP+E3a0TuH3jSh7Vev0twjmosqNQZmOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037