UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '28SMrJDJYWGrbewyejRGmcc27sBjv+rkz5ulds1KFM4=' 
WHERE 
  key_id = 'acc24145e895b38d74c820b74a0700f8551f169c40c0cf9afb945dd00b2f8dc8' 
  AND (
    token = '28SMrJDJYWGrbewyejRGmcc27sBjv+rkz5ulds1KFM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053