UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IKhssZ+bOIfal8yBCPfqnAE1lGE83aNEAjSSbOSrYbY=' 
WHERE 
  key_id = '31c2c3829b98cfddc05021f93315e6e57dfe7f061698947b584cb35b4b15c3ed' 
  AND (
    token = 'IKhssZ+bOIfal8yBCPfqnAE1lGE83aNEAjSSbOSrYbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042