UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IRR/OtRYTg5VD42vsh444FnwZmHzdYNHV/r5SG61teU=' 
WHERE 
  key_id = 'c5371029450a60e43b565b4284bdb78fa83e5a3a3bb3763561226b03ee05d94f' 
  AND (
    token = 'IRR/OtRYTg5VD42vsh444FnwZmHzdYNHV/r5SG61teU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019