UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Q4tDB4rMwNMrMIiVTG0Jy62hut4r2lxXEaPHmML2Xk=' 
WHERE 
  key_id = 'ebca186b8a06266ccfb791cddbcffe2683e80e855f2954cef555f0d842ff06be' 
  AND (
    token = '8Q4tDB4rMwNMrMIiVTG0Jy62hut4r2lxXEaPHmML2Xk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030