UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C2dDFtyZREjIt1+zugSSbLthIqyNq3FG67kedH4CAv0=' 
WHERE 
  key_id = 'b5ea23da9a4fe136e0735707b3a694257b69f7c6ab8d197da3e97459efadf708' 
  AND (
    token = 'C2dDFtyZREjIt1+zugSSbLthIqyNq3FG67kedH4CAv0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034