UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mu7kftjiOCViOAspzIpcd804oGRkeu+dkhopg8pBMBA=' 
WHERE 
  key_id = '038746ce0abf6cca32d6b6cec2df5285e2a61bdcb2a2780d94757bafb8269664' 
  AND (
    token = 'Mu7kftjiOCViOAspzIpcd804oGRkeu+dkhopg8pBMBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034