UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdMzDigAmR1Tyd+8jJO72VPHaTp6jS5yV539r7Tpf1Q=' 
WHERE 
  key_id = '088ea8b6011f072002e7d7ce56eff69cc3811795aa29eb701be3869e5f03e668' 
  AND (
    token = 'bdMzDigAmR1Tyd+8jJO72VPHaTp6jS5yV539r7Tpf1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026