UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kbg1+qiQz5KjLNF3X3DK8LGp9pA3dOorc3jlpZ/wtGM=' 
WHERE 
  key_id = '4f689a3c6576291efe2810d3a170d6a6a47eed938573b5b52e4a673ceab82794' 
  AND (
    token = 'Kbg1+qiQz5KjLNF3X3DK8LGp9pA3dOorc3jlpZ/wtGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025