UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Y9zTLwIEPd1kI+EosFLz4N3Ol2MJ48nu9qY/NDIXGs=' 
WHERE 
  key_id = 'd87321705bbb99e537bbacf1b50408be2eaa72be14779f0a1d7ff1295f0546c1' 
  AND (
    token = '0Y9zTLwIEPd1kI+EosFLz4N3Ol2MJ48nu9qY/NDIXGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053