UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '16Oi/yve1vLXPgZzT8VXLaxheHF3GvTiKBMHWELB1gc=' 
WHERE 
  key_id = '6365088dfa0b06e97a3bad0005d137d14d4e2a0cba86bab7acff370e85bd5955' 
  AND (
    token = '16Oi/yve1vLXPgZzT8VXLaxheHF3GvTiKBMHWELB1gc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029