UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9Rk9FYi3cB7df/9yGbT5/P5HvipE+SOvo6hPb77Wvs=' 
WHERE 
  key_id = '79048fda6f0f72f4441d560fcf2b1779b33f8a8cc243185161eda7f1f201942b' 
  AND (
    token = 'x9Rk9FYi3cB7df/9yGbT5/P5HvipE+SOvo6hPb77Wvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026