UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yO9sj4uRso0082z2ueUaW/lK3SoA8OLTvDYGkZF8340=' 
WHERE 
  key_id = 'c674a56f11e392e8dc1471f82adb6536254c8f2daf021b4eab1d8db6d22182d1' 
  AND (
    token = 'yO9sj4uRso0082z2ueUaW/lK3SoA8OLTvDYGkZF8340=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030