UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwx7vM6JimT5KokG+9mt35xbRf0n1OJC+H8zX4WNSIw=' 
WHERE 
  key_id = 'bf9f81209f97d69e2712b4711a293ed239ec1a6df6edf7e3825312937b2087fa' 
  AND (
    token = 'iwx7vM6JimT5KokG+9mt35xbRf0n1OJC+H8zX4WNSIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029