UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UHe5odNg1QaYW5B4Qo+RoMLVCJ34xk/otYkKIK+Jfgk=' 
WHERE 
  key_id = 'bcc3ccbb3114c0265103a2798cfde14af624af881be81994baac7f9e3199d5ea' 
  AND (
    token = 'UHe5odNg1QaYW5B4Qo+RoMLVCJ34xk/otYkKIK+Jfgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051