UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4kHbgdJ2dvm+kpDH7VYYpFeesesv8qO0Z2+87PXi2TU=' 
WHERE 
  key_id = 'cb2f52e09cc7a2a09e30d726b502d27a17b8bf7723b10e95f9764554242d624a' 
  AND (
    token = '4kHbgdJ2dvm+kpDH7VYYpFeesesv8qO0Z2+87PXi2TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022