UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OC4UKVxLnOWCpeawB0rmY9wtgqczWnP2AgFbot+yj58=' 
WHERE 
  key_id = 'f8f7c859776cf52b29828fd11d2507065f6b69812f5e86ad43838afcb122a8b1' 
  AND (
    token = 'OC4UKVxLnOWCpeawB0rmY9wtgqczWnP2AgFbot+yj58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018