UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NC5zeaK9LPp9LQheQDFuJ9Ll/wEMMnKFu7pUIhlaaBA=' 
WHERE 
  key_id = '4db8f85677020954abb1d0b3a7a04dde6080667725650cf4b861ff8b9260239c' 
  AND (
    token = 'NC5zeaK9LPp9LQheQDFuJ9Ll/wEMMnKFu7pUIhlaaBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045