UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w6mKLb46Nh1Hh0RZ2ooykOsV2oYcCSCFVwkuLWV387A=' 
WHERE 
  key_id = 'e1c70f0a21505671ba30f438cc338b90da7535d666e4060ba5a5c14d83160421' 
  AND (
    token = 'w6mKLb46Nh1Hh0RZ2ooykOsV2oYcCSCFVwkuLWV387A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042