UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1mfM/88DZOdwn35YNPJ6215RK1lVpQGkFuKHrstJviY=' 
WHERE 
  key_id = '773fe98773dcb011aed38e8193d7d9e355bd24d98296b3842f126dd9e9f15592' 
  AND (
    token = '1mfM/88DZOdwn35YNPJ6215RK1lVpQGkFuKHrstJviY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028