UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iy4A6q3kok5x7MdIYR3TCINXB/WcNsd7jfq17vxh2hk=' 
WHERE 
  key_id = '88eaac1ef48596db8888cea48807d68b690248700ac5e08cf195f9d8ad03d9b3' 
  AND (
    token = 'iy4A6q3kok5x7MdIYR3TCINXB/WcNsd7jfq17vxh2hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028